package com.rlz.framemm.mode.strategy2

import com.rlz.base.app.Base
import com.rlz.base.util.single.Single
import javax.xml.parsers.DocumentBuilderFactory

/**
 * Created by RLZ
 * on 2021/10/26
 *  用于读取xml中定义的文件名称 生产不通过的 策略对象
 */
class XmlUtil {

    companion object : Single<XmlUtil>(::XmlUtil)

    fun getClass(): Any {

        val builder = DocumentBuilderFactory.newInstance().newDocumentBuilder()

        val parse = builder.parse(Base.sAppContext.assets.open("config.xml"))

        val name = parse.getElementsByTagName("className")

        return Class.forName(name.item(0).firstChild.nodeValue).newInstance()
    }
}